#!/usr/bin/env python
#*-*coding=utf-8*-*
'''
Defines misc functions and utilities in file/dir/path handling
'''

import os.path
import sys ; sys.path.append('..\\..')

import file
import dir
import shelltools.os.osinfo as osinfo

def get_path_separator():
    '''
    retrieve the path separator used by os
    '''
    if osinfo.get_os() == 'windows':
        return "\\"
    if osinfo.get_os() == 'linux' :
        return "/"


def basename(path):
    '''
    Get Basename of the current ressource identified by path (can be virtual)
    @param path, the path leading to the ressource
    '''
    try :
        path = path.rstrip(get_path_separator())
        return os.path.basename(path)
    except Exception :
        return False



